﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace agent
{
    public partial class Daemon : Form
    {
        Probe prob;
        FrmCmt frmcmt;

        public Daemon()
        {
            InitializeComponent();

            prob = new Probe();
            frmcmt = new FrmCmt();
            //frmcmt.Hide();
            frmcmt.Show();
        }

        private void tim_Start_Tick(object sender, EventArgs e)
        {
            if (this.Opacity > 0.01)
            {
                this.Opacity -= 0.01;
                //this.Opacity = 0;
            }
            else
            {
                tim_Start.Enabled = false;
                this.tim_Probe.Enabled = true;
                this.Hide();
                this.ni_Icon.Visible = true;
                this.prob.SendEvent(HostOpt.OPT_POWER);
            }
        }

        private void tim_Probe_Tick(object sender, EventArgs e)
        {
            this.prob.ProbeOnce();
        }

        private void Daemon_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.prob.SendEvent(HostOpt.OPT_SHUTDOWN);
        }
    }
}
